package com.szy.mvp_demo.mvp_p;

import com.szy.mvp_demo.Entity.MessageListEntity;
import com.szy.mvp_demo.mvp_m.BaseListModel;
import com.szy.mvp_demo.mvp_m.MessageListModelBJ;
import com.szy.mvp_demo.mvp_m.MessageListModelCJ;
import com.szy.mvp_demo.mvp_m.MessageListModelKJ;
import com.szy.mvp_demo.mvp_m.MessageListModelTT;
import com.szy.mvp_demo.mvp_m.MessageListModelTY;
import com.szy.mvp_demo.mvp_m.MessageListModelYL;
import com.szy.mvp_demo.mvp_m.MessageListModelYW;
import com.szy.mvp_demo.mvp_v.IMessageView;

import java.util.List;

/**
 * Created by Administrator on 2018/1/22 0022.
 * 信息逻辑处理类
 */

public class MessageListPresenter {
    private int type;
    private IMessageView iMessageView;
    private BaseListModel model;

    public MessageListPresenter(int type, IMessageView iMessageView) {
        this.type = type;
        this.iMessageView = iMessageView;
        initModel();
    }

    public void LoadData() {
        model.loadData(onDataSuccedListener);
    }

    private void initModel() {
        model = new MessageListModelBJ();
        switch (type) {
            case 0://头条
                model = new MessageListModelTT();
                break;
            case 1://要闻
                model = new MessageListModelYW();
                break;
            case 2://娱乐
                model = new MessageListModelYL();
                break;
            case 3://财经
                model = new MessageListModelCJ();
                break;
            case 4://体育
                model = new MessageListModelTY();
                break;
            case 5://科技
                model = new MessageListModelKJ();
                break;
            case 6://北京
                model = new MessageListModelBJ();
                break;

        }
    }

    private OnDataSuccedListener onDataSuccedListener = new OnDataSuccedListener() {
        @Override
        public void upDataView(List data) {
            iMessageView.upDataView(data);
        }
    };
}
